#include <stdio.h>
#include <stdlib.h>
#include "main.h"

int main(int argc, char *argv[]) {
	int bin1, bin2;
	bin1 = bin2 = 0;
	char binstr[8 * sizeof(int) +1];

	if(argc < 3) {
		printf("Skladnia: %s <liczba binarna> <liczba binarna>\n", argv[0]);
		exit(1);
	}
	if(verify(argv[1]) == NULL || verify(argv[2]) == NULL) {
		printf("Podane lancuchy nie sa binarne.\n");
		exit(2);
	}
	bin1 = bin2dec(argv[1]);
	bin2 = bin2dec(argv[2]);
	printf("Liczba %d:\t%s\n", bin1, dec2bin(bin1, binstr));
	printf("Liczba %d:\t%s\n", bin2, dec2bin(bin2, binstr));
	printf("Odwrot %d:\t%s\n", ~bin1, dec2bin(~bin1, binstr));
	printf("Odwrot %d:\t%s\n", ~bin2, dec2bin(~bin2, binstr));
	printf("%d OR  %d:\t%s\n",bin1, bin2, dec2bin(bin1|bin2, binstr));
	printf("%d AND %d:\t%s\n",bin1, bin2, dec2bin(bin1&bin2, binstr));
	printf("%d XOR %d:\t%s\n",bin1, bin2, dec2bin(bin1^bin2, binstr));

	return 0;
}
